package com.ponhu.ea2.enums;

import javax.servlet.http.Part;

/**
 * @author zhaokai
 */
public enum InventoryTypeEnum {

    MAIN_PRODUCT(1, "主品"),
    ENCLOSURE(2, "附件"),
    PARTS(3, "配件"),
    GIFT(4, "赠品"),
    ;

    private Integer code;

    private String name;

    InventoryTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getName(Integer code){
        if(MAIN_PRODUCT.code.equals(code)){
            return MAIN_PRODUCT.name;
        }else if(ENCLOSURE.code.equals(code)){
            return ENCLOSURE.name;
        }else if (PARTS.code.equals(code)){
            return PARTS.name;
        }else if(GIFT.code.equals(code)){
            return GIFT.name;
        }else {
            return MAIN_PRODUCT.name;
        }
    }
}
